package com.hxzy.region.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hxzy.region.dao.RegionMapper;
import com.hxzy.region.pojo.Region;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RegionService {

    @Autowired
    private RegionMapper regionMapper;

    public Page<Region> getAll(Integer page, Integer pageSize){
        if(page == null){
            page = 1;
        }
        if(pageSize == null){
            pageSize = 10;
        }

        Page<Region> pg = new Page<Region>(page,pageSize);
        return regionMapper.selectPage(pg, null);
    }

    public int addRegion(Region region){
        return regionMapper.insert(region);
    }

}
